/*
 ------------------------------------------------------------------------------
 Copyright (C) 2013 Eternal Games.

 This file is part of the GLQuake source code.

 The GLQuake source code is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or (at your
 option) any later version.

 The GLQuake source code is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 more details.

 You should have received a copy of the GNU General Public License along with
 the GLQuake source code; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 ------------------------------------------------------------------------------
*/


//
// common.h - framework used by dynamic-link libraries
//


#ifndef __FRAMEWORK_COMMON_H__
#define __FRAMEWORK_COMMON_H__


/*
 ==============================================================================

 Common:

 Common definitions between client and server.

 ==============================================================================
*/

#define MAX_PRINT_MESSAGE			8192		// Max length of a message printed to the console

struct editorCallbacks_t {
	// Called by LaunchEditor to create the window for the active editor.
	// Should return the handle of the created window, or NULL if an error
	// occurred.
	void *					(*createWindow)();

	// Called by CloseEditor to destroy the window for the active editor
	void					(*destroyWindow)();

	// Called by the client system for left mouse button down events to let the
	// active editor select an entity for editing.
	// Should return true if the client system should skip generating game
	// commands for said event.
	// This function can be NULL if the active editor doesn't need to select
	// entities.
	bool					(*mouseEvent)();
};

struct glqCommon_t {
	// Prints a message to the console, and possibly to the log file
	void					(*Printf)(const char *fmt, ...);

	// Like Printf, but only prints the message in developer mode
	void					(*DPrintf)(const char *fmt, ...);

	// Throws an error and aborts the current frame. If fatal is true, it will
	// quit to the system console and wait for the user to terminate the
	// program.
	void					(*Error)(bool fatal, const char *fmt, ...);

	// Launches an integrated editor.
	// Note that only one editor can be active at a time.
	bool					(*LaunchEditor)(const char *name, editorCallbacks_t *callbacks);

	// Closes the currently active integrated editor
	void					(*CloseEditor)();

	// Returns true if an integrated editor is currently active
	bool					(*IsEditorActive)();
};


#endif	// __FRAMEWORK_COMMON_H__